import axiosReq from '@/utils/axios-req'
import { useBasicStore } from '@/store/basic'

const BASE_URL = import.meta.env.VITE_APP_BASE_URL_SYH
/**
 * 项目信息-下拉列表
 * @param data 
 * {
	"name": "苏州",
	"pageNo": 1,
	"pageSize": 10
  }
 * @returns 
 */
export const projectInfoList = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/projectInfo/listOptions`,
    method: 'POST',
    data
  })
}

/**
 * 项目信息-分页列表
 * @param data{
  "projectName": "",
  "projectNumber": "",
  "buyNumber": "",
  "status": "",
  "pageNo": 1,
  "pageSize": 10
}
 * @returns
 */
export const projectInfoListPage = (data: any) => {
  const loginName = useBasicStore().userInfo.username
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/projectInfo/list`,
    method: 'POST',
    data: {
      ...data,
      loginName
    }
  })
}

/**
 * 项目信息-跳转项目信息验证
 * @param data 
 * {
  "projectName": "跨境电商业务服务外包",
  "projectNumber": "CG2025-0158",
  "projectDirector": "杨翼萌",
  "projectAssistant": "杨翼萌",
  "projectReviewer": "吴伟",
  "unitName": "苏州市跨境电商产业发展有限公司",
  "unitContacts": "/",
  "unitPhone": "/",
  "prePrice": 3550000.0,
  "maxPrice": 3550000.0,
  "openBidTime": "2025-03-14 14:00:00",
  "openBidPlace": "苏州高新区科技城潇湘路99号诚来智研发大楼5楼会议室"
}
 * @returns 
 */
export const projectInfoCheck = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/projectInfo/check`,
    method: 'POST',
    data
  })
}

/**
 * 项目信息-获取最高限价
 * @param data
 * @returns
 */
export const projectInfoMaxPrice = (projectId: string) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/projectInfo/getMaxPrice?projectId=${projectId}`,
    method: 'GET'
  })
}
